package com.xyzq.cgate.common.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;

import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author chenchen
 * @since 2019-06-11
 */
public class Rule extends Model<Rule> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @TableId(type = IdType.INPUT)
    private String id;
    /**
     * 插件名称
     */
    @TableField("plugin_name")
    private String pluginName;
    /**
     * 规则名称
     */
    @TableField("rule_name")
    private String ruleName;

    /**
     * 匹配条件
     */
    @TableField("match_condition")
    private String matchCondition;
    /**
     * 负载均衡
     */
    @TableField("load_balance")
    private String loadBalance;
    /**
     * 降级熔断
     */
    @TableField("hystrix_param")
    private String hystrixParam;
    /**
     * 执行顺序
     */
    @TableField("rule_order")
    private Integer ruleOrder;

    /**
     * 每秒请求数
     */
    @TableField("permits_per_second")
    private String permitsPerSecond;

    @TableField("app_key")
    private String appKey;

    @TableField("app_secret")
    private String appSecret;

    @TableField("black_list")
    private String blackList;

    @TableField("gray_release")
    private String grayRelease;
    /**
     * 是否开启（0，未开启，1开启）
     */
    private Integer enabled;

    @TableField("uniquejson")
    private String uniquejson;
    
    @TableField(exist = false)
    private boolean enabledContent;

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getAppSecret() {
        return appSecret;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    public String getBlackList() {
        return blackList;
    }

    public void setBlackList(String blackList) {
        this.blackList = blackList;
    }

    public String getGrayRelease() {
        return grayRelease;
    }

    public void setGrayRelease(String grayRelease) {
        this.grayRelease = grayRelease;
    }

    public boolean isEnabledContent() {
        return enabledContent;
    }

    public void setEnabledContent(boolean enabledContent) {
        this.enabledContent = enabledContent;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPluginName() {
        return pluginName;
    }

    public void setPluginName(String pluginName) {
        this.pluginName = pluginName;
    }

    public String getRuleName() {
        return ruleName;
    }

    public void setRuleName(String ruleName) {
        this.ruleName = ruleName;
    }

    public String getMatchCondition() {
        return matchCondition;
    }

    public void setMatchCondition(String matchCondition) {
        this.matchCondition = matchCondition;
    }

    public String getLoadBalance() {
        return loadBalance;
    }

    public void setLoadBalance(String loadBalance) {
        this.loadBalance = loadBalance;
    }

    public String getUniquejson() {
        return uniquejson;
    }

    public void setUniquejson(String uniquejson) {
        this.uniquejson = uniquejson;
    }

    public String getHystrixParam() {
        return hystrixParam;
    }

    public void setHystrixParam(String hystrixParam) {
        this.hystrixParam = hystrixParam;
    }

    public Integer getRuleOrder() {
        return ruleOrder;
    }

    public void setRuleOrder(Integer ruleOrder) {
        this.ruleOrder = ruleOrder;
    }

    public Integer getEnabled() {
        return enabled;
    }

    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    public String getPermitsPerSecond() {
        return permitsPerSecond;
    }

    public void setPermitsPerSecond(String permitsPerSecond) {
        this.permitsPerSecond = permitsPerSecond;
    }

    @Override
    public String toString() {
        return "Rule{" +
                "id='" + id + '\'' +
                ", pluginName='" + pluginName + '\'' +
                ", ruleName='" + ruleName + '\'' +
                ", matchCondition='" + matchCondition + '\'' +
                ", loadBalance='" + loadBalance + '\'' +
                ", hystrixParam='" + hystrixParam + '\'' +
                ", ruleOrder=" + ruleOrder +
                ", permitsPerSecond=" + permitsPerSecond +
                ", enabled=" + enabled +
                ", uniquejson='" + uniquejson + '\'' +
                ", enabledContent=" + enabledContent +
                '}';
    }
}
